<?php
/***
	家庭用户模型。
**/
class Family_model extends CI_Model {
	
	public function __construct() {
		$this->load->database();
	}
	
	
	//新增
	public function create () {
		
		$passwd = $this->input->post('passwd');
		$passwd = password_hash($passwd, PASSWORD_DEFAULT);
		
		$data = array(
			'id' => $this->input->post('id'),
			'passwd' => $passwd
			
		);
		$this->db->insert('fmly_user', $data);
	}
	
	//由id返回一个用户
	public function get_by_id($id) {
		
		$query = $this->db->get_where('fmly_user', array('id' => $id));
		return $query->row_array();
		
	}
	

}
